![]() |
WOLF core
WOLF: A Modular Estimation Framework for Robotics
|
Base class of processors: they process the captures of a sensor and the keyframes created by other processors, creating features, factors, landmarks and voting for keyframes. More...
#include <core/processor/processor_base.h>
Public Member Functions | |
| void | startCaptureProfiling () |
| Starts the profiling of a capture processing. More... | |
| void | stopCaptureProfiling () |
| Stops the profiling of a capture processing. More... | |
| void | startKFProfiling () |
| Starts the profiling of a keyframe processing. More... | |
| void | stopKFProfiling () |
| Stops the profiling of a keyframe processing. More... | |
| virtual void | printProfiling (std::ostream &stream=std::cout) const |
| Prints the profiling of the capture and keyframe processing. More... | |
| ProcessorBase (const std::string &_type, const TypeComposite &_state_types, const YAML::Node &_params) | |
| Constructor. More... | |
| ~ProcessorBase () override | |
| virtual void | configure (SensorBasePtr _sensor)=0 |
| Configures the processor once linked to its sensor. More... | |
| virtual void | remove () |
| Removes the processor from its sensor (and from the motion providers of the problem) More... | |
| bool | hasChildren () const override |
| Returns whether the node has children in the Wolf tree. More... | |
| const TypeComposite & | getStateTypes () const |
| Returns the state types of the frames created or used by this processor. More... | |
| StateKeys | getStateKeys () const |
| Returns the state keys of the frames created or used by this processor. More... | |
| unsigned int | id () const |
| Returns the processor id. More... | |
| void | keyFrameCallback (FrameBasePtr _keyframe) |
| Notifies a new keyframe (created by another processor) More... | |
| void | captureCallback (CaptureBasePtr _capture) |
| Notifies a new capture. More... | |
| SensorBaseConstPtr | getSensor () const |
| Returns the sensor the processor belongs to. More... | |
| SensorBasePtr | getSensor () |
| Returns the sensor the processor belongs to. More... | |
| YAML::Node | getParams () const |
| Returns a copy of the YAML parameters. More... | |
| bool | isMotionProvider () const |
| Returns whether the processor is a MotionProvider. More... | |
| bool | applyLossFunction () const |
| Returns whether the factors created by the processor apply a loss function. More... | |
| bool | isVotingActive () const |
| Returns whether the processor can vote for keyframes. More... | |
| double | getTimeTolerance () const |
| Returns the time tolerance to associate time stamps. More... | |
| void | setApplyLossFunction (bool _apply_loss_function) |
| Sets whether the factors created by the processor apply a loss function. More... | |
| void | setVotingActive (bool _voting_active) |
| Sets whether the processor can vote for keyframes. More... | |
| void | setTimeTolerance (double _time_tolerance) |
| Sets the time tolerance to associate time stamps. More... | |
| void | setDebugVerboseLevel (const std::string &_debug_verbose_level) |
| Sets the debug verbosity level: "none", "derived", "base" or "all". More... | |
| std::string | getDebugVerboseLevel () const |
| Returns the debug verbosity level. More... | |
| bool | checkTimeTolerance (const TimeStamp &_ts1, const TimeStamp &_ts2) const |
| Returns whether two time stamps are within the time tolerance. More... | |
| bool | checkTimeTolerance (const CaptureBasePtr _cap, const TimeStamp &_ts) const |
| Returns whether the capture and a time stamp are within the time tolerance. More... | |
| bool | checkTimeTolerance (const FrameBasePtr _frm, const TimeStamp &_ts) const |
| Returns whether the frame and a time stamp are within the time tolerance. More... | |
| bool | checkTimeTolerance (const FrameBasePtr _frm, const CaptureBasePtr _cap) const |
| Returns whether the frame and the capture are within the time tolerance. More... | |
| virtual void | link (SensorBasePtr) final |
| Links the processor to a sensor. More... | |
| virtual void | printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const |
| Prints the information of this node (not of its children) More... | |
| void | print (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const |
| Prints this node and, depending on the depth, its children. More... | |
| virtual CheckLog | localCheck (bool _verbose, std::ostream &_stream, std::string _tabs="") const |
| Checks the consistency of this node (not of its children) More... | |
| bool | check (CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const |
| Checks the consistency of this node and its children, composing the log. More... | |
Public Member Functions inherited from wolf::NodeBase | |
| NodeBase (const std::string &_category, const std::string &_type="Undefined", const std::string &_name="") | |
| Constructor. More... | |
| virtual | ~NodeBase ()=default |
| Destructor. More... | |
| unsigned int | nodeId () const |
| Returns the node id, unique over the whole Wolf tree. More... | |
| std::string | getCategory () const |
| Returns the category of the node. More... | |
| std::string | getType () const |
| Returns the type (subcategory) of the node. More... | |
| std::string | getName () const |
| Returns the name of the node. More... | |
| bool | isRemoving () const |
| Returns whether the node is being removed. More... | |
| virtual bool | hasChildren () const =0 |
| Returns whether the node has children in the Wolf tree. More... | |
| void | setType (const std::string &_type) |
| Sets the type (subcategory) of the node. More... | |
| void | setName (const std::string &_name) |
| Sets the name of the node. More... | |
| ProblemConstPtr | getProblem () const |
| Returns the problem the node belongs to. More... | |
| ProblemPtr | getProblem () |
| Returns the problem the node belongs to. More... | |
Protected Member Functions | |
| virtual void | processCapture (CaptureBasePtr)=0 |
| Processes an incoming capture. More... | |
| virtual void | processKeyFrame (FrameBasePtr _keyframe_ptr)=0 |
| Processes an incoming keyframe. More... | |
| virtual bool | triggerInCapture (CaptureBasePtr) const =0 |
| Returns whether processCapture() should be called after the provided capture arrived. More... | |
| virtual bool | triggerInKeyFrame (FrameBasePtr) const =0 |
| Returns whether processKeyFrame() should be called after the provided keyframe arrived. More... | |
| virtual bool | storeKeyFrame (FrameBasePtr)=0 |
| Returns whether the provided keyframe should be stored in buffer_frame_. More... | |
| virtual bool | storeCapture (CaptureBasePtr)=0 |
| Returns whether the provided capture should be stored in buffer_capture_. More... | |
| virtual bool | voteForKeyFrame () const =0 |
| Votes for keyframe generation. More... | |
| virtual bool | permittedKeyFrame () const final |
| Returns whether this processor can create a keyframe: voting is active and the problem permits it. More... | |
| void | setProblem (ProblemPtr) override |
| Sets the problem, adding the state types to it and, if it is a state provider, the processor as motion provider. More... | |
| void | addTypes (const TypeComposite &) |
| Adds the provided state types to the processor and to the problem (if set). Throws if a key already has a different type. More... | |
| virtual void | setProblem (ProblemPtr _prob_ptr) |
| Sets the problem the node belongs to. More... | |
Protected Attributes | |
| unsigned int | processor_id_ |
| Processor id, unique among processors. More... | |
| YAML::Node | params_ |
| YAML parameters. More... | |
| BufferFrame | buffer_frame_ |
| Buffer of the received keyframes to be processed. More... | |
| BufferCapture | buffer_capture_ |
| Buffer of the received captures to be processed. More... | |
| std::string | debug_verbose_level_ |
| Debug verbosity level: "none", "derived", "base" or "all". More... | |
Protected Attributes inherited from wolf::NodeBase | |
| ProblemWPtr | problem_ptr_ |
| Problem the node belongs to. More... | |
| unsigned int | node_id_ |
| Node id. It is unique over the whole Wolf Tree. More... | |
| std::string | node_category_ |
| Text label identifying the category of node ("SENSOR", "FEATURE", etc) More... | |
| std::string | node_type_ |
| Type or subcategory of node (derived class name: "SensorOdom2d", etc) More... | |
| std::string | node_name_ |
| bool | is_removing_ |
| A flag for safely removing nodes from the Wolf tree. See remove(). More... | |
Base class of processors: they process the captures of a sensor and the keyframes created by other processors, creating features, factors, landmarks and voting for keyframes.
| wolf::ProcessorBase::ProcessorBase | ( | const std::string & | _type, |
| const TypeComposite & | _state_types, | ||
| const YAML::Node & | _params | ||
| ) |
Constructor.
| _type | TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: type name |
| _state_types | TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: The composite of state types of the frames created or used by this processor |
| _params | params yaml node |
|
override |
|
protected |
Adds the provided state types to the processor and to the problem (if set). Throws if a key already has a different type.
|
inline |
Returns whether the factors created by the processor apply a loss function.
| void wolf::ProcessorBase::captureCallback | ( | CaptureBasePtr | _capture | ) |
Notifies a new capture.
It applies the first frame options of the problem (if not applied yet), stores the capture in buffer_capture_ if storeCapture(), and processes it with processCapture() if triggerInCapture().
| bool wolf::ProcessorBase::check | ( | CheckLog & | _log, |
| bool | _verbose, | ||
| std::ostream & | _stream, | ||
| std::string | _tabs = "" |
||
| ) | const |
Checks the consistency of this node and its children, composing the log.
| bool wolf::ProcessorBase::checkTimeTolerance | ( | const CaptureBasePtr | _cap, |
| const TimeStamp & | _ts | ||
| ) | const |
Returns whether the capture and a time stamp are within the time tolerance.
| bool wolf::ProcessorBase::checkTimeTolerance | ( | const FrameBasePtr | _frm, |
| const CaptureBasePtr | _cap | ||
| ) | const |
Returns whether the frame and the capture are within the time tolerance.
| bool wolf::ProcessorBase::checkTimeTolerance | ( | const FrameBasePtr | _frm, |
| const TimeStamp & | _ts | ||
| ) | const |
Returns whether the frame and a time stamp are within the time tolerance.
| bool wolf::ProcessorBase::checkTimeTolerance | ( | const TimeStamp & | _ts1, |
| const TimeStamp & | _ts2 | ||
| ) | const |
Returns whether two time stamps are within the time tolerance.
|
pure virtual |
Configures the processor once linked to its sensor.
Implemented in wolf::ProcessorDiffDrive, wolf::ProcessorFixedWingModel, wolf::ProcessorLandmarkExternal, wolf::ProcessorLoopClosure, wolf::ProcessorOdom2d, wolf::ProcessorOdom3d, and wolf::ProcessorPose< DIM >.
|
inline |
Returns the debug verbosity level.
|
inline |
Returns a copy of the YAML parameters.
|
inline |
Returns the sensor the processor belongs to.
|
inline |
Returns the sensor the processor belongs to.
|
inline |
Returns the state keys of the frames created or used by this processor.
|
inline |
Returns the state types of the frames created or used by this processor.
|
inline |
Returns the time tolerance to associate time stamps.
Recommended value: half of the sensor period (or smaller). Larger values are allowed (the closest element is always chosen), but time stamps up to the tolerance apart are considered the same instant, which introduces errors.
|
inlineoverridevirtual |
Returns whether the node has children in the Wolf tree.
Implements wolf::NodeBase.
|
inline |
Returns the processor id.
|
inline |
Returns whether the processor is a MotionProvider.
|
inline |
Returns whether the processor can vote for keyframes.
| void wolf::ProcessorBase::keyFrameCallback | ( | FrameBasePtr | _keyframe | ) |
Notifies a new keyframe (created by another processor)
It stores the keyframe in buffer_frame_ if storeKeyFrame(), and processes it with processKeyFrame() if triggerInKeyFrame().
|
finalvirtual |
Links the processor to a sensor.
|
virtual |
Checks the consistency of this node (not of its children)
|
finalprotectedvirtual |
Returns whether this processor can create a keyframe: voting is active and the problem permits it.
| void wolf::ProcessorBase::print | ( | int | depth, |
| bool | factored_by, | ||
| bool | metric, | ||
| bool | state_blocks, | ||
| std::ostream & | stream = std::cout, |
||
| std::string | _tabs = "" |
||
| ) | const |
Prints this node and, depending on the depth, its children.
|
virtual |
Prints the information of this node (not of its children)
Reimplemented in wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
virtual |
Prints the profiling of the capture and keyframe processing.
Reimplemented in wolf::ProcessorTracker.
|
protectedpure virtual |
Processes an incoming capture.
Each derived processor should implement this function. It will be called if:
Implemented in wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorLoopClosure, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
protectedpure virtual |
Processes an incoming keyframe.
Each derived processor should implement this function. It will be called if:
Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
virtual |
Removes the processor from its sensor (and from the motion providers of the problem)
|
inline |
Sets whether the factors created by the processor apply a loss function.
|
inline |
Sets the debug verbosity level: "none", "derived", "base" or "all".
|
overrideprotectedvirtual |
Sets the problem, adding the state types to it and, if it is a state provider, the processor as motion provider.
Reimplemented from wolf::NodeBase.
|
inline |
Sets the time tolerance to associate time stamps.
|
inline |
Sets whether the processor can vote for keyframes.
|
inline |
Starts the profiling of a capture processing.
|
inline |
Starts the profiling of a keyframe processing.
| void wolf::ProcessorBase::stopCaptureProfiling | ( | ) |
Stops the profiling of a capture processing.
| void wolf::ProcessorBase::stopKFProfiling | ( | ) |
Stops the profiling of a keyframe processing.
|
protectedpure virtual |
Returns whether the provided capture should be stored in buffer_capture_.
Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
protectedpure virtual |
Returns whether the provided keyframe should be stored in buffer_frame_.
Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
protectedpure virtual |
Returns whether processCapture() should be called after the provided capture arrived.
Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
protectedpure virtual |
Returns whether processKeyFrame() should be called after the provided keyframe arrived.
Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.
|
protectedpure virtual |
Votes for keyframe generation.
If a KeyFrame criterion is validated, this function returns true, meaning that it wants to create a KeyFrame at the last Capture.
WARNING! This function only votes! It does not create KeyFrames!
Implemented in wolf::ProcessorFixedWingModel, wolf::ProcessorLandmarkExternal, wolf::ProcessorLoopClosure, wolf::ProcessorMotion, wolf::ProcessorOdom2d, wolf::ProcessorOdom3d, wolf::ProcessorPose< DIM >, wolf::ProcessorTracker, wolf::ProcessorTrackerFeature, and wolf::ProcessorTrackerLandmark.
|
protected |
Buffer of the received captures to be processed.
|
protected |
Buffer of the received keyframes to be processed.
|
protected |
Debug verbosity level: "none", "derived", "base" or "all".
|
protected |
YAML parameters.
|
protected |
Processor id, unique among processors.